package cn.gene.store.order.webapi.service;

import cn.gene.store.order.service.IOmsOrderService;
import cn.gene.timeyan.pojo.store.order.dto.ExchangeOrderDTO;
import cn.gene.timeyan.pojo.store.order.dto.OrderAddDTO;
import static org.junit.jupiter.api.Assertions.*;

import cn.gene.timeyan.pojo.store.order.vo.OrderAddVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class OmsOrderSerivce {
    @Autowired
    private IOmsOrderService iOmsOrderService;

    @Test
    public void OrderTest(){
        OrderAddDTO orderAddDTO = new OrderAddDTO();
        orderAddDTO.setUserId(1L);
        orderAddDTO.setGoodsId(1L);
        orderAddDTO.setAddress("km");
        orderAddDTO.setPhone("1234567");
        orderAddDTO.setActualScore(10);
        orderAddDTO.setPurchaseVolume(2);
        assertDoesNotThrow(()->{
            OrderAddVO orderAddVO = iOmsOrderService.addOrder(orderAddDTO);
            System.out.println(orderAddVO);
        });

    }

    @Test
    public void exchangeOrder(){
        ExchangeOrderDTO exchangeOrderDTO = new ExchangeOrderDTO();
        exchangeOrderDTO.setUserId(1L);
        exchangeOrderDTO.setGoodsId(1L);
        exchangeOrderDTO.setActualScore(10);
        exchangeOrderDTO.setPurchaseVolume(2);
        assertDoesNotThrow(()->{
            iOmsOrderService.exchange(exchangeOrderDTO);
        });
    }
}
